<?php
namespace Mob \ Controller;

use Think \ Controller;
use Think \ Hook;

class OrderController extends BaseController {



	public function _initialize() {
		parent :: _initialize();
		$this->_top_menu_list = array (
			'left' => array (
				array (
					'type' => 'home',
					'href' => U('Mob/Task/index'
				)
			),
			array (
				'type' => 'message'
			),


		), 'center' => array (
			'title' => '任务'
		));
		if (is_login()) {
			if (check_auth('Weibo/Index/doSend')) {
				$this->_top_menu_list['right'][] = array (
					'type' => 'edit',
					'href' => U('Mob/Weibo/addWeibo'
				));
			} else {
				$this->_top_menu_list['right'][] = array (
					'type' => 'edit',
					'info' => '你没有发布任务权限！'
				);
			}
		} else {
			$this->_top_menu_list['right'][] = array (
				'type' => 'edit',
				'info' => '登录后才能操作！'
			);
		}
		//dump($this->_top_menu_list);exit;

		$this->UserInfo = query_user(array('nickname', 'avatar64', 'uid'), $v['uid']);
		$this->setMobTitle('任务');
		$this->assign('top_menu_list', $this->_top_menu_list);
	}

	 /**
	 * 主页面显示
	 */
	public function index() {


		$this->display();

	}
    /**
	 * 支付跳转页
	 */

	public function GoPay()
	{
	$PayType= I('PayType');  //取支付类型
	$Serialno = I('Serialno');//取业务流水号
	switch($PayType)
	{
	  case 1:   //如果支付类型为任务
	  $Task = D('Task');  //实例化模型
	  $result = $Task->getTaskDetail($Serialno);  //取任务详情
      if($result)
      {
       if($result['PayStatus']!=1)  //判断一下任务没有被支付过呢 --其实吧感觉这么想也不太对呢，水平有限后期再改吧。
       {
       $Order['Money']=	$result['deliverMoney'];  //取支付金额
       $Order['OrderID']=$result['OrderId'];  //取任务信息中订单ID
       $Order['PayMode']=$result['PayMode'];  //取支付模式




       }else   //任务已经支付过了
       {
        print_r('OrderId is  Pay!');

       }


      }

	  break;
	  case 2:
	  break;

	}
    if($Order)  //如果订单信息不为空
    {

     $this->redirect('Portal/PayMent/index',array('taskSerialno'=>$Serialno,'Money'=>$Order['Money'],'PayMode'=>$Order['PayMode'],'OrderID'=>$Order['OrderID']));

    }
	}

	public function MyOrder()
	{
	$Uid = get_uid();  //取用户ID




	}

	public function PayOrder()
	{

    $businessId = I('businessId');
    




	}








}



